TK!2
=v
=u
=l
#1
:n
U
:v
0
2
6
10
12
E
#2
:n
V
:v
0
4
6
8
12
E
#3
:n
u
:v
0
.4
.8
1.2
1.6
2
2.8
3.6
4.4
5.2
6
6.800000000000001
7.600000000000001
8.4
9.200000000000001
10
10.4
10.8
11.2
11.6
12
E
#4
:n
v
:v
0
1.437
2.348
3.025
3.561
4
4.555
4.992
5.361
5.689
6
6.311
6.639
7.008
7.445
8
8.439
8.975
9.652000000000001
10.563
12
E
#5
:n
index
:v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
E
#6
:n
X
:v
2
7
14
18
20
20
17
13
10
11
14
18
24
31
E
#7
:n
Y
:v
15
18
20
19
16
11
5
3
5
10
14
17
20
22
E
#8
:n
x
:v
2
2.84
3.76
4.76
5.84
7
8.4
9.84
11.28
12.68
14
15.008
15.904
16.696
17.392
18
18.56
19.04
19.44
19.76
20
20.192
20.296
20.304
20.208
20
19.576
19.048
18.432
17.744
17
16.216
15.408
14.592
13.784
13
12.224
11.512
10.888
10.376
10
9.944000000000001
10.032
10.248
10.576
11
11.472
12.016
12.624
13.288
14
14.688
15.424
16.216
17.072
18
19.072
20.216
21.424
22.688
24
25.32
26.68
28.08
29.52
31
E
#9
:n
y
:v
15
15.68
16.32
16.92
17.48
18
18.544
19.032
19.448
19.776
20
20.008
19.904
19.696
19.392
19
18.56
18.04
17.44
16.76
16
15.128
14.184
13.176
12.112
11
9.720000000000001
8.44
7.2
6.04
5
4.28
3.72
3.32
3.08
3
3.112
3.376
3.784
4.328
5
5.888
6.864
7.896
8.952
10
10.88
11.72
12.52
13.28
14
14.648
15.264
15.856
16.432
17
17.632
18.256
18.864
19.448
20
20.48
20.92
21.32
21.68
22
E
=f
#1
:n
Smooth1
:c
Smoothing of monotonically changing  x
:t
Procedure
:i
FAB,A,B,a,b,n
#2
:n
Smooth2
:c
Smoothing of arbitrary data points x,y
:t
Procedure
:i
A,B,a,b,n
#3
:n
UVdata
:t
List
:d
U
:m
Cubic
:r
V
#4
:n
X
:t
List
:d
index
:m
Cubic
:r
X
#5
:n
Y
:t
List
:d
index
:m
Cubic
:r
Y
#1
:n
Smooth1
:z
" Notation:  FAB   name of list function linking the lists of x and y values
"            A,B   lists with argument and function values
"            a,b   target lists for smoothed  x,y  coordinates
"              n   number of additional points to insert into each interval

call blank(a)
call blank(b)
k:= 1
for i=1 to length(A)-1
   H:= A[i]
   a[k]:= H
   b[k]:= B[i]
   k:= k + 1
   h:= (A[i+1]-H)/(n+1)
   for j=1 to n
      H:= H + h
      a[k]:= H
      b[k]:= apply(FAB,H)
      k:= k + 1
   next j
next i
a[k]:= A[i+1]
b[k]:= B[i+1]
/E
E
#2
:n
Smooth2
:z
" Notation:  A,B  names of list functions linking the lists of  x  and  y
"                 values with list  index  containing natural numbers 1,2,...
"            a,b  target lists for smoothed  x,y  coordinates
"              n  number of additional points to be inserted in each interval

" Note:  It may be necessary, if the points are very unequally spaced, to
" replace the natural numbers in the list  index  by an incremental distance
" between the points.  See the cancelled statements below.

call blank(a)
call blank(b)
'index[1]:= 0               " generating incremental distance        ÄÄÄÄ¿
for i=2 to length(A)        "                                            ³
   'index[i]:= 'index[i-1] + sqrt( (A[i]-A[i-1])^2 + (B[i]-B[i-1])^2 ) " ³
next i                      "                                        ÄÄÄÄÙ
k:= 1
h:= 1/(n+1)                       " cancelled when using incremental distance
for i=1 to length(A)-1
   a[k]:= A[i]
   b[k]:= B[i]
   k:= k + 1
   H:= i                          " cancelled when using incremental distance
   H:= 'index[i]                  " activated when using incremental distance
   h:= ('index[i+1]-'index[i])/(n+1)    "      "     "        "         "
   for j=1 to n
      H:= H + h
      a[k]:= apply(A,H)
      b[k]:= apply(B,H)
      k:= k + 1
   next j
next i
a[k]:= A[i+1]
b[k]:= B[i+1]
/E
11
12
13
14
22
23
E
#3
:n
UVdata
#4
:n
X
#5
:n
Y
=r
#1
:r
"            ***   D a t a   P o i n t   S m o o t h i n g   ***
:s
C
#3
:r
call Smooth1('UVdata,'U,'V,'u,'v,4)
#4
:r
call Smooth2('X,'Y,'x,'y,4)
#6
:r
" TK user-defined list functions with cubic interpolation may be used
:s
C
#7
:r
" conveniently for approximating data points with a smooth curve.  This
:s
C
#8
:r
" model presents two procedure functions serving that purpose.
:s
C
#10
:r
" 1. Procedure  Smooth1  for sets of data points with monotonicallly increa-
:s
C
#11
:r
"    sing or decreasing argument:  Five pairs of coordinates U,V were made
:s
C
#12
:r
"    into a list function  UVdata  with cubic interpolation.  The procedure
:s
C
#13
:r
"    Smooth1  subdivides each interval into  5  subintervals and generates
:s
C
#14
:r
"    4  additional points within each interval.  The raw data with linear
:s
C
#15
:r
"    interpolation and the smoothed curve may be seen on the plots  UV_data
:s
C
#16
:r
"    and  uv_curve  respectively.
:s
C
#18
:r
" 2. Procedure  Smooth2  for sets of arbitrary data points:  Fourteen pairs
:s
C
#19
:r
"    of coordinates  X,Y  were made into two list functions (called  X  and
:s
C
#20
:r
"    Y ) with cubic interpolation.  Their domain list  index  consists of
:s
C
#21
:r
"    natural numbers  1,2,3,...  and their range lists are the lists  X  and
:s
C
#22
:r
"    Y .  The procedure  Smooth2  subdivides each interval into 5 subinter-
:s
C
#23
:r
"    vals and generates 4 additional points in each interval.  The raw data
:s
C
#24
:r
"    with linear interpolation and the smoothed curve may be seen on the
:s
C
#25
:r
"    plots xy_data  and  xy_curve  respectively.
:s
C
=p
#1
:n
UV_data
:t
Line chart
:d
EGA
:i
""
:s
Yes
:z
None
:g
No
:l
None
:h
""
:v
""
:x
U
:u
#1
:y
V
:f
1
:p
Both
:c
"*"
E
#2
:n
uv_curve
:t
Line chart
:d
EGA
:i
""
:s
Yes
:z
None
:g
No
:l
None
:h
""
:v
""
:x
u
:u
#1
:y
v
:f
1
:p
Lines
:c
"*"
E
#3
:n
XY_data
:t
Line chart
:d
EGA
:i
""
:s
Yes
:z
None
:g
No
:l
None
:h
""
:v
""
:x
X
:u
#1
:y
Y
:f
1
:p
Both
:c
"*"
E
#4
:n
xy_curve
:t
Line chart
:d
EGA
:i
""
:s
Yes
:z
None
:g
No
:l
None
:h
""
:v
""
:x
x
:u
#1
:y
y
:f
1
:p
Lines
:c
"*"
E
=t
#1
:n
dataUV
:s
Screen
:v
Vertical
:f
1
:r
""
:c
""
:t
""
:u
#1
:l
U
:w
10
:h
""
#2
:l
V
:w
10
:h
""
E
#2
:n
dataXY
:s
Screen
:v
Vertical
:f
1
:r
""
:c
""
:t
""
:u
#1
:l
X
:w
10
:h
""
#2
:l
Y
:w
10
:h
""
E
=n
=g
#1
:c
.000001
:i
10
:v
Yes
:l
60
:f
66
:m
0
:w
80
:b
Yes
:a
Yes
:r
Yes
:h
No
:t
1
:n
Yes
:d
LPT1
%Tr,f,0,1,0,1,0
